{% load i18n %}
<!--begin header-->

<script src="/static/lib/csrf.js"></script>
<script>
    function set_lang(code){
        var str = $("#form_lang").serialize()
        str += '&language='+code
        $.post("{%url 'set_language'%}",
            str,
            function(data){
                window.location.reload()
            });
    }
</script>
<div class=" top-fix nav-default">
    <div class="header">
        <a class="logo">
            <img src="/static/home_page/images/logo1.png"/>
        </a>
        <ul class="nav">
            <li class="home"><a class="hover" href="{%url 'index'%}"><i class="icon-home"></i><span>{%trans '首页'%}<i></i></span></a></li>
            <li class="trading-center"><a class="" href="{%url 'trade' %}"><i class="icon-trading-center"></i><span>{% trans '交易中心' %}<i></i></span></a> </li>
            <li class="piont-piont"><a class=" " href="{%url 'c2c'%}"><i class="icon-piont-piont"></i><span>{% trans '点对点交易' %}<i></i></span></a> </li>
        </ul>
        <div class="lang">
            <span class="lang-li">
                {% get_current_language as LANGUAGE_CODE %}
                {% get_current_language as LANGUAGE_CODE %}
                {% get_available_languages as LANGUAGES %}
                {% get_language_info_list for LANGUAGES as languages %}
                {% for language in languages %}
                {% if language.code == LANGUAGE_CODE %}
                <a class="{{ language.code }}"></a>
                <em>
                {{language.name_local}}
                </em>
                {% endif %}
                {% endfor %}
            </span>
            <div class="lanague">
                <ul class="" style="position: absolute;right:-35px; top:-131px;">
                    <li class="zh-hans">
                        <a href="javascript:;" onclick="set_lang('zh-hans')">简体中文</a>
                    </li>
                    <li class="zh-hant">
                        <a href="javascript:;" onclick="set_lang('zh-hant')">繁體中文</a>
                    </li>
                    <li class="en">
                        <a href="javascript:;" onclick="set_lang('en')">English</a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="appdown">
            <span class="app-download">{% trans 'APP下载' %}</span>
            <div class="down-list">
                <dl>
                    <dd>{% trans '扫描下载APP' %}</dd>
                    <dd>
                        <img src="/static/home_page/images/appdown_code.png"/>
                    </dd>
                </dl>
            </div>
        </div>
        {% if user.is_authenticated %}
        <div class="top-logout">
            <span class=""> <a href="{%url 'userinfo' %}">{% trans '用户中心' %} </span>  |
            <a href="/users/logout/?next={%url 'trade'%}">{% trans '退出' %} </a>
        </div>
        {% else %}
        <div class="top-login">
            <a href="/users/login?next=/{%url 'trade'%}"class="login">{% trans '登录' %}</a>
            <a href="/users/register?next=/{%url 'users:register'%}"class="login">{% trans '注册' %}</a>
        </div>
        {% endif %}
    </div>
</div>
<!--end header-->
